package com.scm.servlet.pomain;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.scm.dao.PomainDao;
import com.scm.model.Pomain;

/**
 * 采购单明细
 * @author Surrik_Zhang
 */
@WebServlet(urlPatterns={"/main/finance/pomainDetail","/main/pomain/pomainDetail"})
public class PomainDetailServlet extends HttpServlet{
	private static final long serialVersionUID = -7918792694999217771L;
	private static final Logger LOGGER = Logger.getLogger(PomainDetailServlet.class);
		@Override
		protected void doGet(HttpServletRequest req, HttpServletResponse resp)
				throws ServletException, IOException {
			String poid = req.getParameter("poid");
			//查询明细
			Long poId = Long.parseLong(poid);
			try {
				Pomain pomain = new PomainDao().queryByPoid(poId);
				req.setAttribute("pomain", pomain);
				req.getRequestDispatcher("/main/pomain/pomain_detail_layer.jsp").forward(req, resp);
			} catch (SQLException e) {
				LOGGER.error("【查看采购单详情】-异常",e);
			}
			
		}
		
		@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp)
				throws ServletException, IOException {
			doGet(req, resp);
		}
}
